package ihm;

import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

import javax.swing.JFrame;

import main.Main;



public abstract class Fenetre extends JFrame implements WindowListener {


	
	public Fenetre() {
		super();
		this.addWindowListener(this);
		this.setSize(800, 350);
	}	

	public void onFermeture() {
		Main.listeFenetres.remove(this);
		if (Main.listeFenetres.size() == 0) System.exit(0);
	}

	public void dispose() {
		this.onFermeture();
		super.dispose();
	}

	public void windowClosing(WindowEvent e){
		this.onFermeture();
	}

	@Override
	public void windowActivated(WindowEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void windowClosed(WindowEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void windowDeactivated(WindowEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void windowDeiconified(WindowEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void windowIconified(WindowEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void windowOpened(WindowEvent arg0) {
		// TODO Auto-generated method stub

	}
}


